package com.adcc.monitoragent.bean;



/**
 * ip + port 唯一确定
 * 内存数据库监控
 * 
 * @author charlie
 * 
 */
public class RedisBean extends BaseBean {
	private static final long serialVersionUID = 1L;
	/**
	 * 固定窜
	 */
	private  String fixType = "redis";
	private String port;// 端口
	private String db;// 数据库
	private String dbSize;// 数据库数量
	private String keySize;// 键值数量
	private String saveTime;// 上次保存时间

	public RedisBean() {
		super();
	}

	public RedisBean(String key) {
		super();
		String[] temp = key.split(":");
		if(temp.length == 2) {
			this.ip = temp[0];
			this.port = temp[1];
		}
	}
	public String getPort() {
		return port;
	}

	public void setPort(String port) {
		this.port = port;
	}

	public String getDb() {
		return db;
	}

	public void setDb(String db) {
		this.db = db;
	}

	public String getDbSize() {
		return dbSize;
	}

	public void setDbSize(String dbSize) {
		this.dbSize = dbSize;
	}

	public String getKeySize() {
		return keySize;
	}

	public void setKeySize(String keySize) {
		this.keySize = keySize;
	}

	public String getSaveTime() {
		return saveTime;
	}

	public void setSaveTime(String saveTime) {
		this.saveTime = saveTime;
	}

	@Override
	public String toString() {
		return "RedisBean [fixType=" + fixType + ", port=" + port + ", db="
				+ db + ", dbSize=" + dbSize + ", keySize=" + keySize
				+ ", saveTime=" + saveTime + "]";
	}

	public String getFixType() {
		return fixType;
	}
	
	/**
	 * 获取关键字唯一标识
	 * @return
	 */
	public String buildKey() {
		return this.ip + ":" + this.port;
	}
	/**
	 * 获取展现名称   ip+port
	 */
	public void setShowName() {
		setShowName("Redis");
	}
}
